<template>
  <div>
    <div class="header">
      <span>账户流水</span>
      <Icon type="ios-arrow-back" size="18" style="position: absolute;left: 10px;" @click="back" />
    </div>
    <Tabs v-model="activeName">
      <TabPane label="钱包转配资流水" name="name1">
        <div class="table">
          <Table :no-data-text="$t('common.nodata')" :columns="columns" :data="orders" :loading="loading"></Table>
        </div>
      </TabPane>
      <TabPane label="配资转钱包流水" name="name2">
        <div class="table">
          <Table :no-data-text="$t('common.nodata')" :columns="columns" :data="orders2" :loading="loading"></Table>
        </div>
      </TabPane>
    </Tabs>
  </div>
</template>

<script>
import expandRow from "@components/exchange/expand.vue";
export default {
  components: { expandRow },
  name: "TransferDetail",
  data() {
    const self = this;
    return{
      activeName: 'name1',
      columns: [
        {
          title: "序号",
          type: "index",
          width: 60,
          render: (h, params) => {
            return h(expandRow, {
              props: {
                skin: params.row.skin,
                rows: params.row.detail
              }
            });
          }
        },
        // {
        //   title: self.$t("exchange.time"),
        //   key: "time",
        //   minWidth: 55,
        //   render: (h, params) => {
        //     return h("span", {}, self.dateFormat(params.row.time));
        //   }
        // },
        //
        {
          title: "订单号",
          key: "numbers",
          render(h, params) {
            return h(
                "span",
                {
                  attrs: {
                    title: params.row.orders
                  }
                },
                params.row.orders
            );
          }
        }, {
          title: self.$t("uc.finance.trade.turnover"),
          key: "turnover",
          render(h, params) {
            return h(
                "span",
                {
                  attrs: {
                    title: params.row.m
                  }
                },
                params.row.m
            );
          }
        }
      ],
      orders: [],
      orders2: [],
      loading: false
    }
  },
  created() {
    this.getHistory()
  },
  methods: {
    back() {
      this.$router.back()
    },
    getHistory() {
      this.loading = true;
      var that = this;
      this.orders = [];
      this.orders2 = [];
      this.$http
          .get( "/api/getTransferDetail?token="+sessionStorage.getItem('token')+"&type=1")
          .then(response => {
            var resp = response.body;
            console.log(resp)
            this.orders = resp.data
            this.loading = false;
          });
      this.$http
          .get( "/api/getTransferDetail?token="+sessionStorage.getItem('token')+"&type=2")
          .then(response => {
            var resp = response.body;
            console.log(resp)
            this.orders2 = resp.data
            this.loading = false;
          });
    }
  }
}
</script>

<style scoped>
.header {
  text-align: center;
  position: relative;
  padding: 10px;
  font-size: 18px;
}
</style>